package com.config;

import com.interceptor.FirstInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author WZ
 * @version 1.0
 * @date 2021/9/1 15:57
 */

@Configuration
public class AdminWebConfig implements WebMvcConfigurer {
	@Autowired
	public FirstInterceptor firstInterceptor;
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//addPathPatterns 拦截哪些请求
		//excludePathPatterns 放行哪些请求
//	  registry.addInterceptor(new LoginInterceptor())
//			  .addPathPatterns("/**")//所有请求都被拦截，包括静态资源
//			  .excludePathPatterns("/hello2");//放行请求
		registry.addInterceptor(firstInterceptor)
		.addPathPatterns("/*","/anime/*")
		.excludePathPatterns("/login","/**/error","/**/redisTest","/register","/randomKiara","/myWs","/onlineUserList","/anime/findRotationChatList");
	}

}
